package com.wennimei.dao;

import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;

import com.wennimei.domain.User;

@DAO
public interface UserDAO {

    @SQL("insert into user (reg_type,renren_id,weixin_id,sinawb_id,country,province,city,sex,add_time) "
            + "values (:1.regType,:1.renrenId,:1.weixinId,:1.sinawbId,:1.country,:1.province,:1.city,:1.sex,now())")
    public void insert(User user);

    @SQL("update user set reg_type = :1.regType,renren_id = :1.renrenId,weixin_id = :1.weixinId,"
            + "sinawb_id = :1.sinawbId,country = :1.country,province = :1.province,city = :1.city,sex = :1.sex "
            + "where id = :1.id")
    public void update(User user);

    @SQL("select * from user where weixin_id = :1")
    public User getWeixinUser(String weixinId);

    @SQL("select * from user where renren_id = :1")
    public User getRenrenUser(String renrenId);

    @SQL("select * from user where sinawb_id = :1")
    public User getSinawbUser(String sinawbId);
}
